//
//  AppDelegate.swift
//  JCNewsForMac
//
//  Created by ifly on 13/7/18.
//  Copyright © 2018年 Ismail. All rights reserved.
//

import Cocoa

@NSApplicationMain
class AppDelegate: NSObject, NSApplicationDelegate {



    func applicationDidFinishLaunching(_ aNotification: Notification) {
        // Insert code here to initialize your application
        
        
        
        
    }

    func applicationWillTerminate(_ aNotification: Notification) {
        // Insert code here to tear down your application
    }
    
    func applicationShouldHandleReopen(_ sender: NSApplication, hasVisibleWindows flag: Bool) -> Bool {
        
        if JCUserModel.isLog() {
            
            NSApp.activate(ignoringOtherApps: false)
            
            let storyboard = NSStoryboard.init(name: NSStoryboard.Name.init("Main"), bundle: nil)
            let vc:NSWindowController = storyboard.instantiateController(withIdentifier: NSStoryboard.SceneIdentifier.init("JCListWindowController")) as! NSWindowController
            vc.window?.makeKeyAndOrderFront(nil)
        }
        return true
    }


}

